//
//  DDHdrCloud.h
//  MyClouds
//
//  Created by sarah doo on 13-8-11.
//  Copyright (c) 2013年 sarah doo. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "DDCommentDic.h"
@interface DDHdrCloud : NSObject
{
    NSData *hdrs;
    NSMutableData *entity;
}

//软件签名
@property (nonatomic, retain)NSString *signature;
//软件版本号
@property (nonatomic, assign)int version; 
//crc验证号
@property (nonatomic, assign)int crc;
//命令字
@property (nonatomic, assign)int cmd;
//数据长度
@property (nonatomic, assign)int length;
//数据包字节数组
@property (nonatomic, retain)NSData *hdrs;

@property (nonatomic, retain)NSMutableData * entity;

//将得到的数据放在hdrs数组当中
- (id)initWithData:(NSData *)data;

- (id)init;

//返回消息头数据
- (NSData *)hdrData;

//把字节转换成为整形
- (int)dataToInt:(NSData *)subData;

//把字节转换成为字符串
- (NSString *)dataToString:(NSData *)data;

- (long)dataToLong:(NSData *)data;
//验证CRC是否正确
- (BOOL)verifyCRC:(NSData *)data;

//计算CRC的值
- (int)crcs:(NSData *)data withLength:(int)lengths;

//把数据的值进行转换
- (NSData *)sortData:(NSData *)data;

- (NSData *)intToData:(int)i;

- (void)printHead;

@end
